package com.nbsaas.boot.marketing.rest.resource;

import com.nbsaas.boot.marketing.api.apis.PointsRecordApi;
import com.nbsaas.boot.marketing.data.entity.PointsRecord;
import com.nbsaas.boot.marketing.api.domain.request.PointsRecordRequest;
import com.nbsaas.boot.marketing.api.domain.response.PointsRecordResponse;
import com.nbsaas.boot.marketing.api.domain.simple.PointsRecordSimple;
import com.nbsaas.boot.marketing.rest.convert.PointsRecordSimpleConvert;
import com.nbsaas.boot.marketing.rest.convert.PointsRecordEntityConvert;
import com.nbsaas.boot.marketing.rest.convert.PointsRecordResponseConvert;
import com.nbsaas.boot.marketing.data.repository.PointsRecordRepository;

import java.io.Serializable;
import com.nbsaas.boot.jpa.data.core.BaseResource;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import jakarta.annotation.Resource;
import org.springframework.data.jpa.repository.support.JpaRepositoryImplementation;

import java.util.function.Function;
/**
*   积分记录-业务接口实现
*/
@Transactional
@Service
public class PointsRecordResource extends BaseResource<PointsRecord,PointsRecordResponse, PointsRecordSimple, PointsRecordRequest>  implements PointsRecordApi {

    @Resource
    private PointsRecordRepository pointsRecordRepository;

    @Override
    public JpaRepositoryImplementation<PointsRecord, Serializable> getJpaRepository() {
        return pointsRecordRepository;
    }

    @Override
    public Function<PointsRecord, PointsRecordSimple> getConvertSimple() {
        return new PointsRecordSimpleConvert();
    }

    @Override
    public Function<PointsRecordRequest, PointsRecord> getConvertForm() {
        return new PointsRecordEntityConvert();
    }

    @Override
    public Function<PointsRecord, PointsRecordResponse> getConvertResponse() {
        return new PointsRecordResponseConvert();
    }




}


